<!-- 简历编辑 -->
<template>
  <div>
    <div class="eda-main-title">
      <div class="top-icon">
        <img src="../../../assets/img/personnelImage/创建流程图.png"/>
      </div>
      <div class="top-title">
        简历中心 - 编辑
      </div>
      <div class="top-operate">
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button type="primary" @click="subInt">加入人才库</el-button>
        <!--        <el-button type="primary" @click="this.$common.goloc()">取消</el-button>-->
      </div>
    </div>
    <div class="eda-main">
      <div class="main-middle">
        <el-form :model="formData" ref="vForm" :rules="rules" label-position="left" label-width="80px"
                 size="default" @submit.prevent>
          <div class="table-container">
            <table class="table-layout">
              <tbody>
              <tr>
                <td colspan="4" style="border-bottom:#e7b599 solid 1px;">
                  <div class="static-content-item">
                    <div>个人信息</div>
                    <el-form-item label="" label-width="0" prop="input76662">
                      <el-input v-model="formData.id" type="text" style="display: none" clearable/>
                    </el-form-item>
                  </div>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>姓名</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="name">
                    <el-input v-model="formData.name" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
                <td>
                  <div class="static-content-item">
                    <div>性别</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="sex">
                    <el-input v-model="formData.sex" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>所学专业</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="major">
                    <el-input v-model="formData.major" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
                <td>
                  <div class="static-content-item">
                    <div>证件编号</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="id_card">
                    <el-input v-model="formData.id_card" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>居住地</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="domicile_place">
                    <el-input v-model="formData.domicile_place" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
                <td>
                  <div class="static-content-item">
                    <div>出生年月</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="birth">
                    <el-input v-model="formData.birth" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>手机号</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="contact_phone">
                    <el-input v-model="formData.contact_phone" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
                <td>
                  <div class="static-content-item">
                    <div>E-mail</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="email">
                    <el-input v-model="formData.email" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>毕业院校</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="graduation_institutions">
                    <el-input v-model="formData.graduation_institutions" readonly="true" type="text" clearable>
                    </el-input>
                  </el-form-item>
                </td>
                <td>
                </td>
                <td>
                </td>
              </tr>
              <tr>
                <td colspan="4" style="border-bottom:#e7b599 solid 1px;">
                  <div class="static-content-item">
                    <div>应聘信息</div>
                  </div>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>岗位匹配</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="position_name">
                    <el-input v-model="formData.position_name" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
                <td>
                  <div class="static-content-item">
                    <div>岗位匹配度</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="match_degree">
                    <el-input v-model="formData.match_degree" readonly="true" type="text" clearable></el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>简历来源</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="source">
                    <el-form-item label="" label-width="0" prop="source" class="required">
                      <el-select v-model="formData.source" class="full-width-input"  :disabled="true" clearable>
                        <el-option v-for="(item, index) in sourceOptions"
                                   :key="index" :label="item.label"
                                   :value="item.value" :disabled="item.disabled"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-form-item>
                </td>
                <td>
                  <div class="static-content-item">
                    <div>简历类别</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="type">
                    <el-select v-model="formData.type" class="full-width-input"  :disabled="true" clearable>
                      <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label"
                                 :value="item.value" :disabled="item.disabled"></el-option>
                    </el-select>
                  </el-form-item>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
          <div class="table-container">
            <table class="table-layout">
              <tbody>
              <tr>
                <td colspan="4" style="border-bottom:#e7b599 solid 1px;">
                  <div class="static-content-item">
                    <div>分类信息</div>
                  </div>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>可跟进性类型</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="follow_up_type">
                    <el-select v-model="formData.follow_up_type" class="full-width-input" clearable>
                      <el-option v-for="(item, index) in followUpTypeOptions" :key="index" :label="item.label"
                                 :value="item.value" :disabled="item.disabled"></el-option>
                    </el-select>
                  </el-form-item>
                </td>
                <td>
                  <div class="static-content-item">
                    <div>人才级别</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="talent_level">
                    <el-select v-model="formData.talent_level" class="full-width-input" clearable>
                      <el-option v-for="(item, index) in talentLevelOptions" :key="index" :label="item.label"
                                 :value="item.value" :disabled="item.disabled"></el-option>
                    </el-select>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <td>
                  <div class="static-content-item">
                    <div>标签</div>
                  </div>
                </td>
                <td>
                  <el-form-item label="" label-width="0" prop="tag">
                    <el-select v-model="formData.tag" class="full-width-input" clearable>
                      <el-option v-for="(item, index) in tagOptions" :key="index" :label="item.label"
                                 :value="item.value" :disabled="item.disabled"></el-option>
                    </el-select>
                  </el-form-item>
                </td>
                <td>
                </td>
                <td>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import {insfocus, selById, uptRescById} from '../../../network/per/inter'
export default {
  components: {},
  props: {},
  data() {
    return {
      formData: {
        id:null,
        name: "",
        sex: "",
        major: "",
        id_card: "",
        domicile_place: "",
        birth: "",
        contact_phone: "",
        email: "",
        graduation_institutions: "",
        position_name: "",
        match_degree: "",
        source: "",
        type: "",
        follow_up_type: 2,
        talent_level: 3,
        tag: 1,
      },
      // 修改参数
      updDate:{
        resumeId:null,
        followUpType:null,
        talentLevel:null,
        tag:null
      },
      // 新增关注参数
      insfollow:{
        acctId:1,
        resumeId:null
      },
      rules: {},
      followUpTypeOptions: [
          {
        "label": "是重点跟进对象",
        "value": 1
      }, {
        "label": "非重点跟进对象",
        "value": 2
      }, {
        "label": "人不合适",
        "value": 3
      }, {
        "value": 4,
        "label": "已入职其他公司"
      }, {
        "value": 5,
        "label": "不在IT行业发展了"
      }],
      talentLevelOptions: [
          {
        "label": "紧跟A类",
        "value": 1
      }, {
        "label": "意向B类",
        "value": 2
      }, {
        "label": "基础C类",
        "value": 3
      }],
      tagOptions: [
          {
        "label": "经验",
        "value": 1
      }, {
        "label": "求职",
        "value": 2
      }, {
        "label": "重点",
        "value": 3
      }, {
        "value": 4,
        "label": "技术"
      }],
      sourceOptions: [
        {
          "label": "51job",
          "value": 1
        }, {
          "label": "智联招聘",
          "value": 2
        }, {
          "label": "猎聘网",
          "value": 3
        }, {
          "value": 4,
          "label": "BOSS直聘"
        }, {
          "value": 5,
          "label": "内推"
        }
      ],
      typeOptions: [
        {
          "label": "  ",
          "value": 1
        }, {
          "label": "主动提交",
          "value": 2
        }, {
          "label": "制动搜索",
          "value": 3
        }
      ],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    let initialId =  this.$route.query.par
    if (initialId !== 0){
      selById(initialId).then((das)=>{
        console.log("后台返回 -> ",das)
        this.formData = das[0];
      })
    }
  },
  methods: {
    subInt(){
      this.insfollow.resumeId = this.formData.id;
      console.log(" this.insfollow.resumeId -> ",  this.insfollow.resumeId)
      insfocus(this.insfollow).then((das)=>{
        if (das.code === 200) {
          this.$notify({
            title: '成功',
            message: '这是一条成功的提示消息',
            type: 'success'
          })
          this.$router.replace('/per/recruit/resume')
        }
      })
    },
    submitForm() {
      this.updDate.resumeId  = this.formData.id;
      this.updDate.followUpType  = this.formData.follow_up_type;
      this.updDate.talentLevel  = this.formData.talent_level;
      this.updDate.tag  = this.formData.tag;

      this.$refs['vForm'].validate(valid => {
        if (!valid) return
        //TODO: 提交表单
        uptRescById(this.updDate).then(data=>{
            if (data.code === 200){
              this.$notify({
                title: '成功',
                message: '这是一条成功的提示消息',
                type: 'success'
              })
              this.$router.replace('/per/recruit/resume')
            }
          })
      })
    },
    resetForm() {
      this.$refs['vForm'].resetFields()
    }
  }
}
</script>

<style lang="scss">
.el-input__inner{
  margin-top: 12px;
}
.el-input-number.full-width-input,
.el-cascader.full-width-input {
  width: 100% !important;
}

.el-form-item--medium {
  .el-radio {
    line-height: 36px !important;
  }

  .el-rate {
    margin-top: 8px;
  }
}

.el-form-item--small {
  .el-radio {
    line-height: 32px !important;
  }

  .el-rate {
    margin-top: 6px;
  }
}

.el-form-item--mini {
  .el-radio {
    line-height: 28px !important;
  }

  .el-rate {
    margin-top: 4px;
  }
}

.clear-fix:before,
.clear-fix:after {
  display: table;
  content: "";
}

.clear-fix:after {
  clear: both;
}

.float-right {
  float: right;
}

</style>

<style lang="scss" scoped>
@import "src/assets/css/personnelCss/EDemandApp.scss";
div.table-container {
  table.table-layout {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;

    td.table-cell {
      display: table-cell;
      height: 36px;
      border: 1px solid #e1e2e3;
    }
  }
}

div.tab-container {}

.label-left-align ::v-deep .el-form-item__label {
  text-align: left;
}

.label-center-align ::v-deep .el-form-item__label {
  text-align: center;
}

.label-right-align ::v-deep .el-form-item__label {
  text-align: right;
}

.custom-label {}

.static-content-item {
  min-height: 20px;
  display: flex;
  align-items: center;

  ::v-deep .el-divider--horizontal {
    margin: 0;
  }
}
</style>